home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6557 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.2 KB  |  63 lines

  1. Path: news1.cris.com!news
  2. From: aubrey@concentric.net (Aubrey Harrison)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What to do when feof() is NOT feof()
  5. Date: 19 Feb 1996 13:26:09 GMT
  6. Organization: Concentric Internet Services
  7. Message-ID: <4g9tph$5ss@spectator.cris.com>
  8. References: <4g7rsj$fnf@spectator.cris.com> <1996Feb19.063026.29889@zcon.com>
  9. NNTP-Posting-Host: cnc022039.concentric.net
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=ISO-8859-1
  12. X-Newsreader: WinVN 0.99.6
  13.  
  14. In article <1996Feb19.063026.29889@zcon.com>, szh@zcon.com∞ says...
  15. [snip]
  16. >On my SunOS system, there is no such ascii 26 byte denoting end of file
  17. >and fgets will *not* terminate in this manner. The point is that by
  18. >making such incorrect responses (like you did by insisting on this
  19. >point) is just plain wrong. It has nothing to do with the language or
  20. >how the end of files are denoted in most operating systems. Even in
  21. >PC's running MSDOS, there is no such requirement that there *must* be
  22. >an ascii 26 at the end of text files. Certain editors (Brief is an
  23. >example. microEMacs is another) can easily be configured to create such
  24. >ascii files without this byte.
  25. >
  26. >Note that even the EOF result returned (look in stdio.h) has nothing to
  27. >do with the actual byte at the end of the file.
  28. >
  29. >The bottom line still is: please do not offer answers if you do not
  30. >know the correct answer.
  31. >-- 
  32. >-------------------------------------------------------------------------
  33. >| Syed Zaeem Hosain          P. O. Box 610097            (408) 441-7021 |
  34. >| Z Consulting Group        San Jose, CA 95161             szh@zcon.com |
  35. >-------------------------------------------------------------------------
  36.  
  37. Nowhere did I say a file had to end with an ascii 26. What I said (or I am 
  38. trying to say), and this is true which is why I can't understand all this 
  39. commotion... On an MS-DOS machine, using Microsoft C, if you do not tell fopen 
  40. you are reading a binary file by using the "rb" parameter inputs such as fgets 
  41. will stop reading and return end-of-file if it encounters an ascii 26 in the 
  42. file. i.e. If the 654th byte of a 60,000 line file is an ascii 26, fgets will 
  43. only read 654 bytes of the file.
  44.  
  45. Once again, the original message did not indicate what OS or compiler the 
  46. person was using. I should have been clearer in my response that I was 
  47. referring to MS-DOS and Microsoft C. I only responded because I have had the 
  48. exact same problem and tracked it down to the fact that while the file I was 
  49. reading was a "text" file there were a few bytes (including ascii 26) that were 
  50. killing fgets and signalling end-of-file when it was not. Maybe he has some 
  51. other problem, maybe he has the same problem. I don't know, and you don't know. 
  52. I think the notion that the only help that could or should ever be given is an 
  53. exact diagnoses and cure to a problem is a little ridiculous and unpractical. 
  54.  
  55. -- 
  56. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  57. Aubrey Harrison    aubrey@concentric.net    75320.1606@compuserve.com
  58. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  59. Loneliness is to endure the presence of one who does not understand.
  60.                                          -Elbert Hubbard (1856-1915)
  61. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  62.  
  63.